/**
 * capacity.cpp is part of Gedule.
 *
 * Gedule is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Gedule is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Gedule.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "capacity.h"
#include "../../../utils/visitor/visitor.h"
#include <sstream>

const std::string Capacity::RESOURCE_CAPACITY_CONSTRAINT = "Capacity";
const tCapacity Capacity::DEFAULT_CAPACITY = 1;

///////////////////////////////////////////////////////////////
Capacity::Capacity( tCapacity a_capacity ) :
    ResourceConstraint(),
    m_capacity( a_capacity )
{
}

///////////////////////////////////////////////////////////////
Capacity::~Capacity()
{
    m_capacity = DEFAULT_CAPACITY;
}

///////////////////////////////////////////////////////////////
void Capacity::Accept( Visitor * a_visitor, bool )
{
    if( a_visitor )
        a_visitor->Visit( this );
}

///////////////////////////////////////////////////////////////
std::string Capacity::Print() const
{
    std::ostringstream strStream;
    strStream << RESOURCE_CAPACITY_CONSTRAINT << " = " << m_capacity;

    return strStream.str();
}

///////////////////////////////////////////////////////////////
void Capacity::SetCapacity( tCapacity a_capacity )
{
    m_capacity = a_capacity;
}

///////////////////////////////////////////////////////////////
tCapacity Capacity::GetCapacity() const
{
    return m_capacity;
}
